VERSION 5.00
Begin VB.Form frmPersoClasificacion 
   Caption         =   "Form1"
   ClientHeight    =   5490
   ClientLeft      =   60
   ClientTop       =   390
   ClientWidth     =   13695
   LinkTopic       =   "Form1"
   ScaleHeight     =   5490
   ScaleWidth      =   13695
   StartUpPosition =   3  'Windows Default
   Begin VB.TextBox Text2 
      BackColor       =   &H00000000&
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FFFFFF&
      Height          =   400
      Left            =   5760
      TabIndex        =   8
      Text            =   "Text1"
      Top             =   3360
      Width           =   3735
   End
   Begin VB.TextBox Text1 
      BackColor       =   &H00000000&
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FFFFFF&
      Height          =   285
      Left            =   5760
      TabIndex        =   7
      Text            =   "Text1"
      Top             =   2760
      Visible         =   0   'False
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Nuevo"
      BeginProperty Font 
         Name            =   "Eras Bold ITC"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   400
      Left            =   2880
      TabIndex        =   6
      Top             =   4320
      Width           =   1335
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Guardar"
      BeginProperty Font 
         Name            =   "Eras Bold ITC"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   400
      Left            =   4440
      TabIndex        =   5
      Top             =   4320
      Width           =   1335
   End
   Begin VB.CommandButton Command3 
      Caption         =   "Cancelar"
      BeginProperty Font 
         Name            =   "Eras Bold ITC"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   400
      Left            =   6000
      TabIndex        =   4
      Top             =   4320
      Width           =   1335
   End
   Begin VB.CommandButton Command4 
      Caption         =   "Modificar"
      BeginProperty Font 
         Name            =   "Eras Bold ITC"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   400
      Left            =   7560
      TabIndex        =   3
      Top             =   4320
      Width           =   1455
   End
   Begin VB.CommandButton Command5 
      Caption         =   "Eliminar"
      BeginProperty Font 
         Name            =   "Eras Bold ITC"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   400
      Left            =   9240
      TabIndex        =   2
      Top             =   4320
      Width           =   1335
   End
   Begin VB.CommandButton Command6 
      Caption         =   "Salir"
      BeginProperty Font 
         Name            =   "Eras Bold ITC"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   400
      Left            =   10800
      TabIndex        =   1
      Top             =   4320
      Width           =   1335
   End
   Begin VB.CommandButton Command10 
      Caption         =   "Buscar"
      BeginProperty Font 
         Name            =   "Eras Bold ITC"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   400
      Left            =   9600
      TabIndex        =   0
      Top             =   3360
      Width           =   1215
   End
   Begin VB.Label SkinLabel1 
      Height          =   495
      Left            =   4320
      TabIndex        =   9
      Top             =   2760
      Visible         =   0   'False
      Width           =   615
   End
   Begin VB.Label SkinLabel2 
      Height          =   405
      Left            =   3840
      TabIndex        =   10
      Top             =   3360
      Width           =   1695
   End
   Begin VB.Label SkinLabel3 
      Height          =   405
      Left            =   6360
      TabIndex        =   11
      Top             =   240
      Width           =   2175
   End
   Begin VB.Label Label1 
      Height          =   885
      Left            =   6360
      TabIndex        =   12
      Top             =   600
      Width           =   4815
   End
End
Attribute VB_Name = "frmPersoClasificacion"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim tabla As DAO.Recordset
Sub Buscar()
    tabla.Index = "primarykey"
    tabla.Seek "=", Text1.Text
    If Not tabla.NoMatch Then
        mostrar
        Bloquear False
        Botones 3
    End If
End Sub
Sub mostrar()
'On Error Resume Next
    Text2.Text = tabla(1)
End Sub
Sub Limpiar()
    Text1.Text = ""
    Text2.Text = ""
End Sub
Sub Bloquear(es As Boolean)
    es = Not es
    Text1.Locked = es
    Text2.Locked = es
End Sub
Sub Guardar()
    tabla(1) = Text2.Text
End Sub

Sub Botones(es As Integer)
    If es = 1 Then
        Command1.Enabled = True
        Command2.Enabled = False
        Command4.Enabled = False
        Command5.Enabled = False
    End If
    If es = 2 Then
        Command1.Enabled = False
        Command2.Enabled = True
        Command4.Enabled = False
        Command5.Enabled = False
    End If
    If es = 3 Then
        Command1.Enabled = False
        Command2.Enabled = False
        Command4.Enabled = True
        Command5.Enabled = True
    End If
        
End Sub
Sub Cancelar()
      Limpiar
      Botones 1
      Bloquear False
End Sub


Private Sub Command1_Click()
    Limpiar
    Bloquear True
    Botones 2
    Text1.Enabled = False
    Text2.SetFocus
    
End Sub

Private Sub Command10_Click()
    FrmBusqueda.CampoDefecto = "nombre"
    FrmBusqueda.tabla = "select *from clasificacion where clasificacion_id >0 "
    FrmBusqueda.UnicoCampo = True
    FrmBusqueda.CampoResultado = "clasificacion_id"
    FrmBusqueda.Show vbModal
    Text1.Text = FrmBusqueda.Resultado
    Buscar
End Sub

Private Sub Command2_Click()
    tabla.Index = "primarykey"
    tabla.Seek "=", Text1.Text
    If tabla.NoMatch Then
        tabla.AddNew
    Else
        tabla.Edit
    End If
    Guardar
    tabla.Update
    Limpiar
End Sub

Private Sub Command3_Click()
    Cancelar
End Sub

Private Sub Command4_Click()
    Bloquear True
    Text1.Enabled = False
    Text2.SetFocus
    Botones 2
End Sub

Private Sub Command5_Click()
    If MsgBox("Esta seguro de eliminar", vbYesNo) = vbYes Then
        tabla.Delete
        Cancelar
    End If
    
End Sub

Private Sub Command6_Click()
    Unload Me
End Sub
Private Sub Command9_Click()
    SendKeys "{TAB}"
End Sub

Private Sub Command7_Click()

End Sub

Private Sub Text1_Validate(Cancel As Boolean)
    Buscar
End Sub

Private Sub Form_Load()
    
    Cancelar
    Me.Caption = titulo2("clasificacion")
    Set tabla = Base.OpenRecordset("clasificacion")
End Sub



